package com.diandian.backend.kuaishou.life.exchange.controller;

import com.diandian.backend.kuaishou.life.exchange.service.BusinessTokenGetService;
import com.diandian.base.boot.starter.response.BaseResult;
import com.diandian.kuaishou.life.boot.starter.service.KuaiShouLifeProductCategoryBasicService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/product/category")
public class ProductCategoryController {

    private static final Logger logger = LoggerFactory.getLogger(ProductCategoryController.class);

    @Autowired
    private KuaiShouLifeProductCategoryBasicService productCategoryService;

    @Autowired
    private BusinessTokenGetService businessTokenGetService;

    /**
     * 商品类目查询
     */
    @GetMapping( "/get")
    public BaseResult getAllStoreInfo(@RequestHeader(name = "appKey") String appKey,
                                      @RequestHeader(name = "appSecret") String appSecret,
                                      @RequestHeader(name = "merchantId") String merchantId,
                                      @RequestParam(name = "categoryId") String categoryId) {
        String token = businessTokenGetService.getToken(appKey, appSecret, merchantId);
        return new BaseResult(0, "success", productCategoryService.getProductCategory(token, categoryId));
    }

}
